package com.zaofan.dao;

import java.sql.SQLException;

import org.apache.commons.dbutils.QueryRunner;

import com.zaofan.bean.OpenBuilder;
import com.zaofan.bean.ShopBuilder;
import com.zaofan.dao.base.DaoSupportImpl;

public class ShopBuilderDao extends DaoSupportImpl<ShopBuilder> {

	public void updateBuilderName(OpenBuilder openBuilder) {
		try {
			String sql = "update " + ShopBuilder.class.getSimpleName().toLowerCase() + " set builderName = '"
					+ openBuilder.getBuilderName() + "' where builderId = " + openBuilder.getId();
			System.err.println(sql);
			QueryRunner runner = new QueryRunner(getDataSource());
			runner.update(sql);
		} catch (SQLException e) {
			e.printStackTrace();
		}

	}

	public void deleteByShopId(int shopId) {
		try {
			String sql = "delete from " + ShopBuilder.class.getSimpleName().toLowerCase() + " where shopId = " + shopId;
			System.err.println(sql);
			QueryRunner runner = new QueryRunner(getDataSource());
			runner.update(sql);
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

}
